﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace TA.Turbo.Controls
{
	/// <summary>
	/// The pager element used for the last page button.
	/// </summary>
	public class LastPageElement : PagerElement
	{
		#region PUBLIC
		#region INIT
		/// <summary>
		/// Ctor.
		/// </summary>
		public LastPageElement()
		{
			this.Text = LastPageElement.DefaultText;
			this.TextImageRelation = LastPageElement.DefaultTextImageRelation;
		}
		#endregion
		#region PROPS
		/// <summary>
		/// Text to be shown in the element.
		/// </summary>
		[DefaultValue(LastPageElement.DefaultText)]
		public override string Text
		{
			get
			{
				return base.Text;
			}
			set
			{
				base.Text = value;
			}
		}
		/// <summary>
		/// Specifies the layout in which the text and the image are output.
		/// </summary>
		[DefaultValue(LastPageElement.DefaultTextImageRelation)]
		public override TextImageRelation TextImageRelation
		{
			get
			{
				return base.TextImageRelation;
			}
			set
			{
				base.TextImageRelation = value;
			}
		}
		#endregion
		#endregion
		#region INTERNAL
		#region CONST/STATIC
		const string DefaultText = ">>";
		const TextImageRelation DefaultTextImageRelation = TextImageRelation.TextBeforeImage;
		#endregion
		#region JSON
		/// <summary>
		/// Gets true if <see cref="StyledLabelElement.Text"/> is dirty.
		/// </summary>
		protected override bool IsTextDirty
		{
			get
			{
				return !string.Equals(this.Text, LastPageElement.DefaultText);
			}
		}
		/// <summary>
		/// Gets true if <see cref="TextImageRelation"/> is dirty.
		/// </summary>
		protected override bool IsTextImageRelationDirty
		{
			get
			{
				return this.TextImageRelation != LastPageElement.DefaultTextImageRelation;
			}
		}
		#endregion
		#endregion
	}
}
